"""
 -*- coding: utf-8-*-
 @File: page_login.py
 @Author: chen
 @time: 2023/09/10/ 17:26
"""
from hogwartsHomework.homework_web_L4.dev.page_base import PageBase
from hogwartsHomework.homework_web_L4.tools.record_log import logger


# 登录页面
class LoginPage(PageBase):
    _BASE_URL = "https://work.weixin.qq.com/wework_admin/loginpage_wx"

    def goto_login(self):
        """进入登录页面"""
        logger.info(f"打开测试网址：{self._BASE_URL}")
        self.do_get(self._BASE_URL)
        return LoginPage(self.driver)

    def save_cookie(self):
        """保存cookie"""
        logger.info("保存cookie")
        self.get_cookies()
        return LoginPage(self.driver)

    def login(self):
        """"""
        logger.info("植入cookie")
        self.add_cookies()
        from dev.page_home import HomePage
        logger.info("登录成功，进入首页")
        return HomePage(self.driver)


if __name__ == '__main__':
    cur_page = LoginPage().goto_login()
    cur_page.save_cookie()
    # cur_page.login()
